$(function () {
    // 配置路径
    var pageUrl = config.urlAnaConfig.testPath;
    // 获取Cookie
    function getCookie(name){
        var strcookie = document.cookie;//获取cookie字符串
        var arrcookie = strcookie.split("; ");//分割
    //       console.log(arrcookie);
        //遍历匹配
        for ( var i = 0; i < arrcookie.length; i++) {
            var arr = arrcookie[i].split("=");
                if (arr[0] ==name){
                    return arr[1];
                }
        }
        return "";
    }
    var name = "tokenval";
    // tiken值
    var cookie_value = getCookie(name);
    console.log(cookie_value);
    var name1 = "userName";
    // 用户名值
    var cookie_value1 = getCookie(name1);
    $(".UserTips span").html(cookie_value1);


    // 初始数据
    var arrchushi = "2,1,25";
    $.ajax({
        url: pageUrl+'/api/activitycompare/getactivitycomparedata',
        type: 'POST',
        dataType: 'json',
        data:{
            ids:arrchushi
        },
        headers: {
            Authorization: 'Bearer '+cookie_value
        },
        success: function (data) {
            var msg = '';
            if (data) {
                if (data.code === 200) {
                    var chooseData = data.data.activitysData;
                    var duibi1 = $(".duibi1");
                    var duibi2 = $(".duibi2");
                    var duibi3 = $(".duibi3");
                        for(var i in chooseData){
                             var sellOutPercent = chooseData[i].sellOutPercent;
                             var targetPercent = chooseData[i].targetPercent;
                             var burstCoefficient = chooseData[i].burstCoefficient;
                             var text = "<span >" + sellOutPercent + " </span>";
                             var tetx2 = "<span >" + targetPercent + " </span>";
                             var tetx3 = "<span >" + burstCoefficient + " </span>";
                             duibi1.append(text);
                             duibi2.append(tetx2);
                             duibi3.append(tetx3);
                        };
                        $(".duibishuju ul").css("padding-left",230);
                        $(".duibishuju ul li").eq(0).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(0).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(0).find("span").eq(2).css("padding-left",300);
                        $(".duibishuju ul li").eq(1).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(1).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(1).find("span").eq(2).css("padding-left",300);
                        $(".duibishuju ul li").eq(2).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(2).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(2).find("span").eq(2).css("padding-left",300);



                }
            }
        },
        error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

    });

    $(".public-select-chose input").on("click",function () {
        // $(this).next(".more-chose").slideToggle();
        $(this).parents(".public-select-chose").siblings().find(".more-chose").hide();
        $(".select-data2").hide();
        $(".select-data3").hide();
        var myThis0 = $(this);
        var opt = $(this).attr("opt");
        if (opt==0){
            $(this).attr('opt','1');
            $(this).next(".more-chose").css("display","inline-flex");
            $(this).nextAll("span").addClass("on-off-select1");
            $(this).nextAll("span").removeClass("on-off-select2");
            if($(this).parent(".public-select-chose").siblings().find("input").attr("opt")==1){
                $(this).parent(".public-select-chose").siblings().find("input").attr('opt','0');
                $(this).parent(".public-select-chose").siblings().find("input").nextAll("span").removeClass("on-off-select1");
                $(this).parent(".public-select-chose").siblings().find("input").nextAll("span").addClass("on-off-select2");
            }
            // 关联1
            $.ajax({
                url: pageUrl+'/api/activitycompare/getplatforms',
                type: 'POST',
                dataType: 'json',
                headers: {
                    Authorization: 'Bearer '+cookie_value
                },
                success: function (data) {
                    var msg = '';
                    if (data) {
                        if (data.code === 200) {
        //                  店铺名称
                            myThis0.next(".more-chose").find(".select-data1 li").remove();
                            var storeName = data.data.platforms;
                            var storeNameF = myThis0.next(".more-chose").find(".select-data1");
                            /*for in 循环*/
                             for(var i in storeName){
                                 var text="<li>"+storeName[i]+"</li>";
                                 storeNameF.append(text);
                             };


                        }
                    }
                },
                error:  function (XMLHttpRequest, textStatus, errorThrown) {
                            // msg
                            var errorTips = XMLHttpRequest.responseJSON.msg;
                            if (errorTips=='Division by zero'){
                                $(".layer1 .content").html("数据错误");
                                $(".layer1").show();
                                console.log(errorTips);
                            } else if(errorTips=='Token has expired'){
                                $(".layer1 .content").html("令牌过期");
                                $(".layer1").show();
                                window.location.href="login.html";
                            }


                        }

            });
        }else if(opt==1){
            $(this).attr('opt','0');
            $(this).next(".more-chose").css("display","none");
            $(this).nextAll("span").removeClass("on-off-select1");
            $(this).nextAll("span").addClass("on-off-select2");
        }
    });

    $(".select-data1").on("mouseenter","li",function (){
        var storeNameData = $(this).html();
        var myThis = $(this);
        $(this).siblings().removeClass("cur");
        $(this).addClass("cur");
        $(this).parent().next(".select-data2").show();
        $(this).parent().nextAll(".select-data3").hide();

        // 关联2
        $.ajax({
            url: pageUrl+'/api/activitycompare/getyearsbyplatform',
            type: 'POST',
            dataType: 'json',
            data: {
                'platform': storeNameData
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
        //                  店铺名称
                        var storeYear = data.data.years;
                        console.log(storeYear);
                        console.log(storeYear)
                        myThis.parent(".select-data1").next(".select-data2").find("li").remove();
                        var storeYearF = myThis.parent().next(".select-data2");
                        /*for in 循环*/
                         for(var i in storeYear){
                             var text="<li>"+storeYear[i]+"</li>";
                             storeYearF.append(text)
                         };
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
    });

    $(".select-data2").on("mouseenter","li",function (){
        var storeYearData = $(this).html();
        var storeNameData = $(this).parent().prevAll(".select-data1").find(".cur").html();
        var myThis3 = $(this);
        $(this).siblings().removeClass("cur");
        $(this).addClass("cur");
        myThis3.parent(".select-data2").next(".select-data3").show();
        // 关联2
        $.ajax({
            url: pageUrl+'/api/activitycompare/getactivitybyplatformandyears',
            type: 'POST',
            dataType: 'json',
            data: {
                'platform': storeNameData,
                "year" :storeYearData
            },
            headers: {
                Authorization: 'Bearer '+cookie_value
            },
            success: function (data) {
                var msg = '';
                if (data) {
                    if (data.code === 200) {
                        myThis3.parent(".select-data2").next(".select-data3").find("li").remove();
                        var storeActivitys = data.data.activitys;
                        var storeActivitysF = myThis3.parent(".select-data2").next(".select-data3");
                        /*for in 循环*/
                         for(var i in storeActivitys){
                             var text="<li idOpt='" +i+ "'>"+storeActivitys[i]+"</li>";
                             storeActivitysF.append(text)
                         };
                    }
                }
            },
            error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

        });
    });
    /*活动对比*/
    $(".select-data3").on("click","li",function () {

        $(this).siblings().removeClass("cur");
        $(this).addClass("cur");
        var NameData = $(this).parent().prevAll(".select-data1").find(".cur").html();
        var YearData = $(this).parent().prevAll(".select-data2").find(".cur").html();
        var activeData = $(this).html();
        console.log(NameData+YearData+activeData);
        $(this).parents(".more-chose").nextAll(".timeModule").find(".select-name1").html(NameData);
        $(this).parents(".more-chose").nextAll(".timeModule").find(".select-name2").html(YearData);
        $(this).parents(".more-chose").nextAll(".timeModule").find(".select-name3").html(activeData);
        $(this).parents(".more-chose").nextAll(".timeModule").show();
        $(this).parents(".more-chose").hide();
        $(this).parents(".public-select-chose").find("input").attr('opt','0');
        $(this).parents(".more-chose").nextAll("span").removeClass("on-off-select1");
        $(this).parents(".more-chose").nextAll("span").addClass("on-off-select2");
    });


    $(document).click(function(){
        $(".public-select-chose").find(".more-chose").hide();
        $(".public-select-chose input").attr('opt','0');
        $(".public-select-chose").find("span").removeClass("on-off-select1");
        $(".public-select-chose").find("span").addClass("on-off-select2");
    });
    $(".public-select-chose").click(function(event){
        event.stopPropagation();
    });

    $(".copySelect").on("click",function (e) {
        var event=e||event;
        event.preventDefault();
    });
    // 复制
    $(".copySelect").on("click",function () {
        $(".application").show();
        $(".remove-btn").show();
        console.log($(".data-btn .public-select-chose").length);
        if ($(".data-btn .public-select-chose").length<3){
            console.log("复制");
            var lip = $(".data-btn .public-select-chose").eq(0).clone(true);
            $(".data-btn").append(lip);
        };
        var choseLength = $(".data-btn .public-select-chose").length;
        if($(".data-btn .public-select-chose").eq(0).find(".select-name3").html()!=''){
            $(".application").attr("disabled",false).addClass("querenguo");
        }
        if(choseLength>1){
            console.log(choseLength-1);
            $(".data-btn .public-select-chose").eq(choseLength-1).find(".select-data3").on("click","li",function () {
                $(".application").attr("disabled",false).addClass("querenguo");
            });
        }
        /*var activeLength = $(".data-btn .public-select-chose").length;
        console.log($(".data-btn .public-select-chose").eq(activeLength-1).find("input").val()+"11111111");
        if($(".data-btn .public-select-chose").eq(activeLength-1).find("input")==''){
            alert(1)
        }*/
        /*if (activeLength>1 && ){
            $(".application").attr("disabled",false).addClass("querenguo");
        }*/
    });
    // 删除
    $(".remove-btn").on("click",function () {
        if ($(".data-btn .public-select-chose").length==1){
            $(".application").hide();
            $(".remove-btn").hide();
        }else if($(".data-btn .public-select-chose").length==2){
            $(this).parent(".public-select-chose").remove();
            $(".remove-btn").hide();
        }else if($(".data-btn .public-select-chose").length==3){
            $(this).parent(".public-select-chose").remove();
        }
    });



     // 图表
    $.ajax({
        url: pageUrl+'/api/common/getaccesstoken',
        type: 'POST',
        dataType: 'json',
        success: function (data) {
            var msg = '';
            if (data) {
                var accessToken = data.data.accessToken.value;
                console.log(accessToken);
                // 组件对比
                var embedUrl1 = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSectiondf5b47f7b94871434b36";
                // 组件详情
                var embedUrl = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSection42b0586a64ac94092294";
                duibitu(accessToken,embedUrl1);
                duibitu2(accessToken,embedUrl);
            }
        },
        error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

    });

    /*活动对比*/
    var pingjieIndex1 = 0;
    var pingjieIndex2 = 0;
    // 确定
    $(".application").on("click",function (e) {
        var event=e||event;
        event.preventDefault();
        var tipsName1 = $(".select-name1").html();
        var tipsName2 = $(".select-name2").html();
        var tipsName3 = $(".select-name3").html();
        console.log(tipsName1+"/"+tipsName2+"/"+tipsName3)
        if (tipsName1 == '' || tipsName2=='' || tipsName3==''){
            alert("请选择完整选项");
            return false;
        };
        // var idAttrO = $(".data-btn .public-select-chose").eq(1).find(".select-data3 .cur").attr("idopt");
        // console.log(idAttrO+"wwwwwwwwwwwwwwwww");

        // 对比数据初始化
        $(".duibi1").find("span").remove();
        $(".duibi2").find("span").remove();
        $(".duibi3").find("span").remove();

        var howL = $(".data-btn .public-select-chose").length;
        howL = howL;
        // id排序
        var arr = [];
        for (var i=0;i<howL;i++){
            var storeActivitys = $(".data-btn .public-select-chose").eq(i).find(".select-data3 .cur").attr("idopt");
            arr.push(storeActivitys);
        };
        function sortNumber(a,b)
        {
        return a - b
        }
        arr.sort(sortNumber);
        var arr1 = '';
        for (var i in arr){
            var arrP = arr[i];
            arr1 += arrP + ",";
        };
        if (arr1.length > 0) {
            arr1 = arr1.substr(0, arr1.length - 1);
        };
        // id排序
        console.log(arr1+"data");
        $.ajax({
        url: pageUrl+'/api/activitycompare/getactivitycomparedata',
        type: 'POST',
        dataType: 'json',
        data:{
            ids:arr1
        },
        headers: {
            Authorization: 'Bearer '+cookie_value
        },
        success: function (data) {
            var msg = '';
            if (data) {
                if (data.code === 200) {
                    console.log("success-----data");
                    var chooseData = data.data.activitysData;

                    var duibi1 = $(".duibi1");
                    var duibi2 = $(".duibi2");
                    var duibi3 = $(".duibi3");
                    if(howL == 2){
                        for(var i in chooseData){
                             var sellOutPercent = chooseData[i].sellOutPercent;
                             var targetPercent = chooseData[i].targetPercent;
                             var burstCoefficient = chooseData[i].burstCoefficient;
                             var text = "<span >" + sellOutPercent + " </span>";
                             var tetx2 = "<span >" + targetPercent + " </span>";
                             var tetx3 = "<span >" + burstCoefficient + " </span>";
                             duibi1.append(text);
                             duibi2.append(tetx2);
                             duibi3.append(tetx3);
                        };
                        $(".duibishuju ul").css("padding-left",327);
                        $(".duibishuju ul li").eq(0).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(0).find("span").eq(1).css("padding-left",572);
                        $(".duibishuju ul li").eq(1).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(1).find("span").eq(1).css("padding-left",572);
                        $(".duibishuju ul li").eq(2).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(2).find("span").eq(1).css("padding-left",572);
                    }else if(howL == 3){
                        for(var i in chooseData){
                             var sellOutPercent = chooseData[i].sellOutPercent;
                             var targetPercent = chooseData[i].targetPercent;
                             var burstCoefficient = chooseData[i].burstCoefficient;
                             var text = "<span >" + sellOutPercent + " </span>";
                             var tetx2 = "<span >" + targetPercent + " </span>";
                             var tetx3 = "<span >" + burstCoefficient + " </span>";
                             duibi1.append(text);
                             duibi2.append(tetx2);
                             duibi3.append(tetx3);
                        };
                        $(".duibishuju ul").css("padding-left",230);
                        $(".duibishuju ul li").eq(0).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(0).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(0).find("span").eq(2).css("padding-left",300);
                        $(".duibishuju ul li").eq(1).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(1).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(1).find("span").eq(2).css("padding-left",300);
                        $(".duibishuju ul li").eq(2).find("span").eq(0).css("padding-left",0);
                        $(".duibishuju ul li").eq(2).find("span").eq(1).css("padding-left",300);
                        $(".duibishuju ul li").eq(2).find("span").eq(2).css("padding-left",300);
                    }


                }
            }
        },
        error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

    });

        // 拼接图形盒子1
        pingjieIndex1++;
        var tu1Id = "reportContainer1";
        tu1Id = tu1Id + pingjieIndex1;
        console.log(tu1Id);
        var arrtx1 = [];
        arrtx1.push("<div class='tu11 no-border'" + "id=" +tu1Id +">");
        arrtx1.push("</div>");
        str0 = arrtx1.join('');
        $(".tu1").append(str0);
        // 删除其他元素
        $('.tu1'+' #'+tu1Id).siblings().remove();
        // 拼接图形盒子2
        pingjieIndex2++;
        var tu2Id = "reportContainer1";
        tu2Id = tu2Id + pingjieIndex2;
        console.log(tu2Id);
        var arrtx2 = [];
        arrtx2.push("<div class='tu22 no-border'" + "id=" +tu2Id +">");
        arrtx2.push("</div>");
        str = arrtx2.join('');
        $(".tu2").append(str);
        // 删除其他元素
        $('.tu2'+' #'+tu2Id).siblings().remove();
         // 图
        var dbIndex = $(".public-select-chose").length;
        if(dbIndex==2){
            console.log("两个");
            var storeActivitysVal = "("+$(".public-select-chose .select-data3 .cur").eq(0).attr("idopt")+","+$(".public-select-chose .select-data3 .cur").eq(1).attr("idopt")+")";
            // 组件详情
            var myUrl = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSection42b0586a64ac94092294";
            var embedUrl = myUrl+"&filter=dm_store_activity_general/id in "+storeActivitysVal;
            // 组件对比
            var myUrl1 = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSectiondf5b47f7b94871434b36";
            var embedUrl1 = myUrl1+"&filter=dm_store_activity_general/id in "+storeActivitysVal;
            $.ajax({
                url: pageUrl+'/api/common/getaccesstoken',
                type: 'POST',
                dataType: 'json',
                success: function (data) {
                    var msg = '';
                    if (data) {
                        var accessToken = data.data.accessToken.value;
                        duibitu(accessToken,embedUrl1);
                        duibitu2(accessToken,embedUrl);
                    }
                },
                error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

            });
        }else if(dbIndex==3){
            console.log("三个");
            var storeActivitysVal = "("+arr1+")";
            // 组件详情
            var myUrl = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSection42b0586a64ac94092294";
            var embedUrl = myUrl+"&filter=dm_store_activity_general/id in "+storeActivitysVal;
            // 组件对比
            var myUrl1 = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSectiondf5b47f7b94871434b36";
            var embedUrl1 = myUrl1+"&filter=dm_store_activity_general/id in "+storeActivitysVal;
            $.ajax({
                url: pageUrl+'/api/common/getaccesstoken',
                type: 'POST',
                dataType: 'json',
                success: function (data) {
                    var msg = '';
                    if (data) {
                        var accessToken = data.data.accessToken.value;
                        duibitu(accessToken,embedUrl1);
                        duibitu2(accessToken,embedUrl);
                    }
                },
                error:  function (XMLHttpRequest, textStatus, errorThrown) {
                    // msg
                    var errorTips = XMLHttpRequest.responseJSON.msg;
                    if (errorTips=='Division by zero'){
                        $(".layer1 .content").html("数据错误");
                        $(".layer1").show();
                        console.log(errorTips);
                    } else if(errorTips=='Token has expired'){
                        $(".layer1 .content").html("令牌过期");
                        $(".layer1").show();
                        window.location.href="login.html";
                    }


                }

            });
        }
    });

    function duibitu(accessToken,embedUrl1) {
        accessToken = accessToken;
        embedUrl = embedUrl1;
        console.log(embedUrl);
        var embedUrl = "https://app.powerbi.cn/reportEmbed?reportId=800f05bc-c465-420e-8542-dbe15d50f1d0&groupId=13e42e94-3404-46d8-b605-228c35984df3&pageName=ReportSectiondf5b47f7b94871434b36";
        var embedReportId = "800f05bc-c465-420e-8542-dbe15d50f1d0";
        var embedpageName = "ReportSectiondf5b47f7b94871434b36";
        var embedvisualName = "0106f2a36f0a758841e2";
        var models = window['powerbi-client'].models;
        var config = {
            type: 'visual',
            accessToken: accessToken,
            embedUrl: embedUrl,
            id: embedReportId,
            pageName: embedpageName,
            visualName: embedvisualName,
        };
        var tu11 = $('.tu11')[0];
        var report = powerbi.embed(tu11, config);
        report.getFilters(models.FiltersLevel.Report)
        .then(function (filters) {
            consolo.log(filters);
        })
        .catch(function (errors) {
            consolo.log(errors);
        });

    };
    function duibitu2(accessToken,embedUrl) {
        accessToken = accessToken;
        embedUrl = embedUrl;
        console.log(embedUrl);
        var embedReportId = "800f05bc-c465-420e-8542-dbe15d50f1d0";
        var models = window['powerbi-client'].models;
        var config = {
            type: 'report',
            accessToken: accessToken,
            embedUrl: embedUrl,
            id: embedReportId,
            viewMode: models.ViewMode.View,
            permissions: models.Permissions.All ,
            settings: {
                filterPaneEnabled: false,
                navContentPaneEnabled: false
            }
        };
        var tu22 = $('.tu22')[0];
        if ("" != "") {
            $("#RLS").prop('checked', true);
            $("#RLSdiv").show();
        }
        else
        {
            $("#RLS").prop('checked', false);
            $("#RLSdiv").hide();
        }
        if ("False" == "True") {
            $("#noRLSdiv").hide();
            $("#RLS").removeAttr("disabled");
            $("#RLS").change(function () {
                if ($(this).is(":checked")) {
                    $("#RLSdiv").show(300);
                } else {
                    $("#RLSdiv").hide(200);
                }
            });
        }
        else
        {
            $("#noRLSdiv").show();
        }
        var report = powerbi.embed(tu22, config);
    };
    // tips弹框
    $(".module-01 .gantan").on("click",function () {
        $(".fixed").show();
        $(".fixedmain").show();
        $(".main-con").html("");
        $(".main-con").html("");
    });
    $(".module-02 .gantan").on("click",function () {
        $(".fixed").show();
        $(".fixedmain").show();
        $(".main-con").html("");
    });
    $('.close_re').click(function(){
        $('.fixed').hide()
        $('.fixedmain').hide()
    });
});